package vip.xiaonuo.biz.modular.lancerUsercoupon.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.biz.modular.lancerUsercoupon.entity.BizUserCoupon;
import vip.xiaonuo.biz.modular.lancerUsercoupon.param.BizUserCouponAddParam;
import vip.xiaonuo.biz.modular.lancerUsercoupon.param.BizUserCouponEditParam;
import vip.xiaonuo.biz.modular.lancerUsercoupon.param.BizUserCouponIdParam;
import vip.xiaonuo.biz.modular.lancerUsercoupon.param.BizUserCouponPageParam;
import vip.xiaonuo.biz.modular.lancerUsercoupon.service.BizUserCouponService;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.common.pojo.CommonValidList;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;

/**
 * C端优惠券控制器
 *
 * @author Lancer
 * @date  2024/03/15 11:48
 */
@Api(tags = "C端优惠券控制器")
@ApiSupport(author = "LANCER_TEAM", order = 1)
@RestController
@Validated
public class ClientUserCouponController {

    @Resource
    private BizUserCouponService bizUserCouponService;

    /**
     * 获取C端优惠券分页
     *
     * @author Lancer
     * @date  2024/03/15 11:48
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation("获取C端优惠券分页")
    @GetMapping("/biz/client/userCoupon/page")
    public CommonResult<Page<BizUserCoupon>> page(BizUserCouponPageParam bizUserCouponPageParam) {
        return CommonResult.data(bizUserCouponService.page(bizUserCouponPageParam));
    }
    @ApiOperationSupport(order = 1)
    @ApiOperation("获取C端优惠券分页")
    @GetMapping("/biz/client/userCoupon/grabCoupon/{id}")
    public CommonResult<String> grabCoupon(@PathVariable String id) {
        bizUserCouponService.grabCoupon(id);
        return CommonResult.ok();
    }

}
